import os

from flask import Flask

from controller.Comment import *
from controller.Jinjiatest import *
from controller.demo import *
from controller.weather import *

app = Flask(__name__, static_url_path="/", static_folder="static", template_folder="templates")
app.config['SECRET_KEY'] = os.urandom(24)
app.register_blueprint(demo1)
app.register_blueprint(comment)
app.register_blueprint(jinjiatest)
app.register_blueprint(weather)


# 全局注册func
def data_display():
    dict1 = {"test": 2342, "rew": "tersdt"}
    return dict1


app.jinja_env.globals.update(my_data_global=data_display)
# #测试全局拦截器
# @app.before_request
# def before_login_auth():
#     url = flask.request.path
#     if url == '/sess':
#         pass
#     elif session.get('isLogin') is not True:
#         return "Login is required"


if __name__ == '__main__':
    app.run(debug=True)
